#include "fstats.h"


void reshape (int w, int h)
{
    glViewport (0, 0, (GLsizei) w, (GLsizei) h);
    glMatrixMode (GL_PROJECTION);
    glLoadIdentity ();
    gluOrtho2D (0.0, (GLdouble) w, 0.0, (GLdouble) h);
}

void init()                                                               
{
    glClearColor (0.0, 0.0, 0.0, 0.0);
    glShadeModel (GL_FLAT);
}

void display()                     
{
	glClear (GL_COLOR_BUFFER_BIT);
	unsigned short size = resultingMatrix[0].size();
	for(unsigned short i = 0; i < size; i++) //Put into the file final vectors...
	{
		for(unsigned short j = 0; j < size; j++)
		{
			if (resultingMatrix[i][j].homeWinsNorm > resultingMatrix[i][j].drawsNorm &&
				resultingMatrix[i][j].homeWinsNorm > resultingMatrix[i][j].visitorWinsNorm) 
					glColor3f ((resultingMatrix[i][j].homeWinsNorm), 0.0f, 0.0f);
			else if (resultingMatrix[i][j].drawsNorm > resultingMatrix[i][j].homeWinsNorm &&
					 resultingMatrix[i][j].drawsNorm > resultingMatrix[i][j].visitorWinsNorm)
					glColor3f (0.0f,(resultingMatrix[i][j].drawsNorm), 0.0f);
			else glColor3f (0.0f, 0.0f, (resultingMatrix[i][j].visitorWinsNorm));
			glBegin(GL_POLYGON);
				glVertex2f(i*30, j*30);
				glVertex2f((i+1)*30, j*30);
				glVertex2f((i+1)*30, (j+1)*30);
				glVertex2f(i*30, (j+1)*30);
			glEnd();
		}
	}
}
